<?php

$event = $this->event;

foreach($this->vote_info as $thread_id=>$thread){
    $voteImgArr = array();
    if(count($thread) >= 1){
        
        foreach($thread as $phase_id=>$phase){
            $now = time();
            if($phase->vote_start_time <= $now && $phase->vote_end_time >= $now){
                $voteImgArr = $this->imgList[$phase->thid][$phase->pid];
                break;
            }
        }
        
    }
    if(empty($voteImgArr)) $voteImgArr = $this->imgList[$phase->thid][$phase->pid];
    $photo_block_id = $thread_id."_".$phase_id;
    $photo_block_title = $phase->thread_name.($phase->phase_name != ""?" - ".$phase->phase_name:"");

?>
            <!--Photo:-->
                <a name="mark_photo_<?=$photo_block_id?>"></a>
                <div id="photo" class="event-area">
                    <div class="event-header-long">
                        <span class="value"><a href="<?php
                            if($phase->votephoto_category > 0)
                                echo 'http://photo.tamtay.vn/category/browse/'.$phase->votephoto_category;
                            else 
                                echo "/event/".$event->short_cut."/votedlist/".$thread_id."/".$phase_id;
                                ?>" title="<?=$photo_block_title?>"><?=$photo_block_title?></a></span>      </div>
                          <div class="event-content-long">
                        <!--Photo Content-->
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>0){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=0; $i<count($voteImgArr) && $i<4; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo EVENT_IMG_SERVER.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            }    // End of for
                        ?>
                        </ul>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>4){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=4; $i<count($voteImgArr) && $i<8; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==4?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <?php } ?>
                        <div class="clear"></div>

                        <!--End Photo Content-->
                            <div class="text-right viewmore"><a href="<?php
                            if($phase->votephoto_category > 0)
                                echo 'http://photo.tamtay.vn/category/browse/'.$phase->votephoto_category;
                            else 
                                echo "/event/".$event->short_cut."/votedlist/".$thread_id."/".$phase_id;
                                ?>">Xem tiếp &raquo;</a></div>
                        </div>
                </div>
                <!--End photo-->
                
<?php } ?>